const express = require("express");
const router = express.Router();

const fBlogInfoAPI = require("@/api/front/blog_info");
const userAPI = require("@/api/v1/user_auth");
const fArticleAPI = require("@/api/front/article");
const fCommentAPI = require("@/api/front/comment");
const fCategoryAPI = require("@/api/front/category");
const fTagAPI = require("@/api/front/tag");
const fLinkAPI = require("@/api/front/friend_link");
const fMessageAPI = require("@/api/front/message");
const codeAPI = require("@/api/front/code");
const emailAPI = require("@/api/front/email");
//获取博客前台信息
router.get("/home", fBlogInfoAPI.GetFrontHomeInfo);

router.post("/login", userAPI.login); //用户登录
router.get("/user/info", userAPI.GetInfo); //获取用户信息
router.post("/register", userAPI.Register);

//获取文章
router.get("/article/list", fArticleAPI.GetFrontList); //文章列表
router.get("/article/like/:article_id", fArticleAPI.SaveLike);
router.get("/archive", fArticleAPI.GetArchiveList); //文章归档
router.get("/article/search", fArticleAPI.Search); //文章搜索
router.get("/article/:id", fArticleAPI.GetFrontInfo); //文章详情

//评论相关
router.get("/comment/list", fCommentAPI.GetFrontList);
router.post("/comment", fCommentAPI.Save);
router.get("/comment/like/:comment_id", fCommentAPI.SaveLike); //前台点赞评论
router.get("/comment/replies/:comment_id", fCommentAPI.GetReplyListByCommentId); //根据评论的id查询恢复

//分类
router.get("/category/list", fCategoryAPI.GetFrontList);

//标签
router.get("/tag/list", fTagAPI.GetFrontList);

//友链
router.get("/link/list", fLinkAPI.GetFrontList);

//留言列表
router.get("/message/list", fMessageAPI.GetFrontList);
router.post("/message", fMessageAPI.Save);

//获取验证码
router.get("/code", codeAPI.CreateCode);
//校验注册用户是否存在
router.get("/email", emailAPI.HasEmail);
module.exports = router;
